package com.example.account.mapper;

import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Mapper
@Repository
public interface AccountMapper {

    @Insert("insert into user_account(user_id,create_time) value (#{user_id},#{create_time})")
    int addAccount(@Param("user_id") String userId, @Param("create_time") String createTime);

    @Update("update user_account set balance = balance+#{balance}")
    int operBal(@Param("user_id") String userId, @Param("balance") String balance);

    @Select("select user_id,balance from user_account where user_id = #{userId}")
    JSONObject selectUserAccount(String userId);
}
